<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    alert("修改前："+window.navigator.userAgent);

    Object.defineProperty(navigator, 'userAgent', {
        value: "ipad",
        writable: false
    });
    alert("修改后："+window.navigator.userAgent);


    const userAgent = navigator.userAgent.toLowerCase()
    console.log(userAgent)
    const device = /ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/;
    if(device.test(userAgent)){
      window.location.href = './phone.html'
    }else{
      window.location.href = './pc.html'
    }
  </script>
</head>
<body>
  
</body>
</html>
